package com.bicon.botu.mall.goods.processor.task;

import com.bicon.botu.mall.goods.processor.service.ProductSyncService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * <p>
 * <p> 商品信息同步
 * </p>
 *
 * @author tao.zeng.
 * @since 2018/3/15.
 */
@Slf4j
@Component
public class ProductSyncTask {

    /**
     * 商品信息同步条件
     */
    @Value("${data.sync.product.sql-where}")
    private String syncWhere;


    @Autowired
    private ProductSyncService productSyncService;

    /**
     * 健康数据同步任务
     * 每天整点执行
     * <p>
     * 每分钟执行 0/60 * * * * ?
     */
    // @Scheduled(cron = "0 0 */1 * * ?")
    public void syncProduct() {
        productSyncService.syncProduct(syncWhere);
        productSyncService.syncProductRepertory(syncWhere);
    }
}
